using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Dal.Entities;

namespace Dal.Mapping
{
	public class DocQuestionMap : EntityTypeConfiguration<DocQuestion>
	{
		public DocQuestionMap()
		{
			// Primary Key
			this.HasKey(t => t.ID);

			// Properties
			this.Property(t => t.FieldName)
				.IsRequired()
				.HasMaxLength(50);
				
			this.Property(t => t.QContent)
				.IsRequired()
				.HasMaxLength(500);
				
			// Table & Column Mappings
			this.ToTable("DocQuestion");
			this.Property(t => t.ID).HasColumnName("ID");
			this.Property(t => t.DocID).HasColumnName("DocID");
			this.Property(t => t.Type).HasColumnName("Type");
			this.Property(t => t.FieldName).HasColumnName("FieldName");
			this.Property(t => t.QContent).HasColumnName("QContent");
			this.Property(t => t.Status).HasColumnName("Status");
			this.Property(t => t.OperateTime).HasColumnName("OperateTime");
			this.Property(t => t.OperateUserID).HasColumnName("OperateUserID");
		}
	}
}

